import { reactive, onMounted } from 'vue'
import { getHomeAllData } from 'network/home'
export default function() {
  let homeData = reactive({
    // 轮播图数据
    banners: [],
    // 获取推荐的数据
    recommends: []
  })
  // 发送home的网络请求
  onMounted(async () => {
    const res = await getHomeAllData()
    homeData.banners = res.slides
    homeData.recommends = res.goods.data
  })
  // getHomeAllData().then(res => {
  //   homeData.banners = res.slides
  //   homeData.recommends = res.goods.data
  // })
  return homeData
}
